package engine.scene
{
	import engine.data.BindManage;
	import engine.data.ModelLocator;
	import engine.scene.SceneManager;

	public class PlayerLogic
	{
		private static var _self	:PlayerLogic;
		
		public static function getInstance():PlayerLogic
		{
			if (_self == null)
			{
				_self = new PlayerLogic();
			}
			return _self;
		}
		
		private	var	_model				:ModelLocator;
		
		private	var	_bindManage			:BindManage;
		
		public function PlayerLogic()
		{
			_model		=	ModelLocator.getInstance();
			_bindManage	=	BindManage.getInstance();
			
			bind();
		}
		
		private function bind():void
		{
			//绑定场景npc信息
			_bindManage.BindRecord(_model.scene,"NpcStatusRec",onAddNpcStatus,onRemoveStatusRec);
		}
		
		//添加npc
		private function onAddNpcStatus(PropertiesName:String,val:*,data:*):void
		{
			//取舞台看看是否有状态改变
			SceneManager.getInstance().changeNpcStage(val);
		}
		
		//删除npc
		private function onRemoveStatusRec(PropertiesName:String,val:*,data:*):void
		{
			//取舞台看看是否有状态改变
			SceneManager.getInstance().changeNpcStage(val);
		}
	}
}